<?php

/**
 * Project form base class.
 *
 * @method Project getObject() Returns the current form's model object
 *
 * @package    vogue
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseProjectForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'           => new sfWidgetFormInputHidden(),
      'name'         => new sfWidgetFormInputText(),
      'route'        => new sfWidgetFormInputText(),
      'aka'          => new sfWidgetFormInputText(),
      'logo'         => new sfWidgetFormInputText(),
      'image'        => new sfWidgetFormInputText(),
      'country_id'   => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Country'), 'add_empty' => false)),
      'location'     => new sfWidgetFormInputText(),
      'genre_id'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Genre'), 'add_empty' => false)),
      'genre'        => new sfWidgetFormInputText(),
      'status'       => new sfWidgetFormInputText(),
      'lyrics'       => new sfWidgetFormInputText(),
      'label'        => new sfWidgetFormInputText(),
      'formed_in'    => new sfWidgetFormInputText(),
      'years_active' => new sfWidgetFormInputText(),
      'about'        => new sfWidgetFormTextarea(),
      'created_at'   => new sfWidgetFormDateTime(),
      'updated_at'   => new sfWidgetFormDateTime(),
      'created_aid'  => new sfWidgetFormInputText(),
      'updated_aid'  => new sfWidgetFormInputText(),
      'nb_views'     => new sfWidgetFormInputText(),
      'sort'         => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'id'           => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'name'         => new sfValidatorString(array('max_length' => 255)),
      'route'        => new sfValidatorString(array('max_length' => 255)),
      'aka'          => new sfValidatorString(array('max_length' => 255)),
      'logo'         => new sfValidatorString(array('max_length' => 255)),
      'image'        => new sfValidatorString(array('max_length' => 255)),
      'country_id'   => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Country'))),
      'location'     => new sfValidatorString(array('max_length' => 255)),
      'genre_id'     => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Genre'))),
      'genre'        => new sfValidatorString(array('max_length' => 255)),
      'status'       => new sfValidatorString(array('max_length' => 255)),
      'lyrics'       => new sfValidatorString(array('max_length' => 255)),
      'label'        => new sfValidatorString(array('max_length' => 255)),
      'formed_in'    => new sfValidatorInteger(),
      'years_active' => new sfValidatorString(array('max_length' => 255)),
      'about'        => new sfValidatorString(),
      'created_at'   => new sfValidatorDateTime(),
      'updated_at'   => new sfValidatorDateTime(array('required' => false)),
      'created_aid'  => new sfValidatorInteger(),
      'updated_aid'  => new sfValidatorInteger(),
      'nb_views'     => new sfValidatorInteger(),
      'sort'         => new sfValidatorInteger(),
    ));

    $this->widgetSchema->setNameFormat('project[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Project';
  }

}
